package com.xbongbong.saas.enums.dictionary;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * 数据字典-退货原因
 *
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/2/26 10:19
 * @since v1.0
 */
@Getter
public enum RefundReasonEnum {

    // 退货原因
    BAD_PRODUCT("1", "enum.refundReason.name.bad_product", "badProduct"),


    QUALITY_ISSUES("2", "enum.refundReason.name.quality_issues", "qualityIssues"),


    WRONG_PRODUCT("3", "enum.refundReason.name.wrong_product", "wrongProduct"),


    OTHER("4", "enum.refundReason.name.other", "other"),
    ;

    private String code;
    private String name;
    private String attr;

    RefundReasonEnum(String code, String name, String attr) {
        this.code = code;
        this.name = name;
        this.attr = attr;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }

    public static Map<String, String> refundReasonMap(){
        Map<String, String> refundReasonMap = new HashMap<>();
        for (RefundReasonEnum value : values()) {
            refundReasonMap.put(value.getCode(), I18nMessageUtil.getMessage(value.getName()));
        }
        return refundReasonMap;
    }
}
